<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var userName = prompt("请输入您的名字", "yourname");
        // document.write("您的名字是:" + userName);
        var age = prompt("请输入您的年龄","yourage");
        if(age>=18){
            document.write(userName+",欢迎您!");
        }else{
            document.write("对不起!本站仅限成人访问.");
        }
    </script>
</body>

</html>